package app_params

import (
	"gitee.com/baizhige/go-server-tempalte/common/constant"
	"github.com/gin-gonic/gin"
)

func TraceId() *TraceIdParam {
	return &TraceIdParam{}
}

type TraceIdParam struct{}

func (t *TraceIdParam) GetParam(ctx *gin.Context) (res any, err error) {
	res, exists := ctx.Get(constant.ContextTraceID)
	if !exists {
		err = TraceIdNotFindErr
		return
	}
	return
}
